package org.apache.flink.runtime.rest.messages.cluster;

import org.apache.flink.runtime.rest.HttpMethodWrapper;
import org.apache.flink.runtime.rest.handler.cluster.ConsumerManagerCustomLogHandler;
import org.apache.flink.runtime.rest.messages.EmptyRequestBody;
import org.apache.flink.runtime.rest.messages.LogFileNamePathParameter;
import org.apache.flink.runtime.rest.messages.RuntimeUntypedResponseMessageHeaders;

/** Headers for the {@link ConsumerManagerCustomLogHandler}. */
public class ConsumerManagerCustomLogHeaders
        implements RuntimeUntypedResponseMessageHeaders<EmptyRequestBody, FileMessageParameters> {

    private static final ConsumerManagerCustomLogHeaders INSTANCE = new ConsumerManagerCustomLogHeaders();

    private static final String URL =
            String.format("/consumermanager/logs/:%s", LogFileNamePathParameter.KEY);

    private ConsumerManagerCustomLogHeaders() {}

    public static ConsumerManagerCustomLogHeaders getInstance() {
        return INSTANCE;
    }

    @Override
    public Class<EmptyRequestBody> getRequestClass() {
        return EmptyRequestBody.class;
    }

    @Override
    public FileMessageParameters getUnresolvedMessageParameters() {
        return new FileMessageParameters();
    }

    @Override
    public HttpMethodWrapper getHttpMethod() {
        return HttpMethodWrapper.GET;
    }

    @Override
    public String getTargetRestEndpointURL() {
        return URL;
    }
}
